#! /bin/sh
# @configure_input@

dir=`dirname $0`

SED=@SED@

$dir/filter_stderr                              |

# Anonymise addresses
$dir/../tests/filter_addresses                  |


#       On FreeBSD if the base and/or lib32 dbg components
#       are installed but not system source then these
#       errors get produced by GDB
$SED -e '/\(rtld_start.S\|kill.S\|_exit.S\|_select.S\): No such file or directory/d' |
# Likewise on some aarch64 GNU/Linux systems for dl-start.S
$SED -e '/dl-start.S: No such file or directory/d' |

# filter vgdb process id,
#             pid
# gdb 7.2 sometimes tries to access address 0x0 (same as with standard gdbserver)
# filter a debian 6.0/ppc32 line
$SED -e '/relaying data between gdb and process/d'                        \
    -e 's/\(sending command .* to pid \)[0-9][0-9]*/\1..../'             \
    -e '/Cannot access memory at address 0x......../d'                   \
    -e '/^[1-9][0-9]*	\.\.\/sysdeps\/powerpc\/powerpc32\/dl-start\.S: No such file or directory\./d' |
    
# filter some debuginfo problems with ld.so and SLES11
$SED -e '/^1	rtld.c: No such file or directory\./d' |
$SED -e '/rtld.c: Inappropriate ioctl for device\./d' |
# similar for Debian 11.0 arm64
$SED -e '/_exit.c: Inappropriate ioctl for device\./d' |
# On FreeBSD, the opional core source package gets
# installed after binaries so gdb complains that rtld_start.S
# is more recent than ld-elf.so.1
$SED -e "/^warning: Source file is more recent than executable./d" |

# filter python loading denied error message (see also filter_gdb.in)
$SED -e '/warning: File .*valgrind-monitor.py.*declined.*/d' |
# and remove loading error messages when python scripts haven't
# been installed yet (running against vg-in-place)
$SED -e '/warning: Missing auto-load script.*/d' |
$SED -e '/warning: Unsupported auto-load script.*/d' |
$SED -e '/of file .*vgpreload.*so.*/d' |
$SED -e '/Use.*info auto-load python-scripts.*/d' |
$SED -e '/warning: Invalid entry in .debug_gdb_scripts section/d' |
$SED -e "/Use .info auto-load python .REGEXP.. to list them./d" |

# Remove python rpm module load warnings
$SED -e "/^Unable to load /d" |
$SED -e "/^the RPM suggestions /d" |
$SED -e "/^installing missing debuginfo /d" |
$SED -e "/^please install /d" |

# and filter out any remaining empty lines
$SED -e '/^$/d'
